from rest_framework import permissions
from users.models import CustomUser


class IsBuyer(permissions.BasePermission):
    """
    仅允许买家访问。
    """

    def has_permission(self, request, view):
        return request.user.role == CustomUser.BUYER
